import request from '@/utils/request'

export const plansComplete = () => {
    return request.get('/plans/complete')
}

export const plansAdd = (form) => {
    return request.post('/plans/add',form)
}

export const plansCompleteChange = (iscomplete,planid,type) => {
    return request.put('/plans/complete',null,{
        params: {
            iscomplete,
            planid,
            type
        }
    })
}

export const plans = (id) => {
    return request.get('/plans/' + id)
}

export const plansUpdate = (form) => {
    return request.post('/plans/update',form)
}

export const plansRemove = (planid,type) => {
    return request.delete('/plans',{
        params: {
            planid,
            type
        }
    })
}

export const plansSon = (form) => {
    return request.post('/plans/son',form)
}

export const plansByCategory = () => {
    return request.get('plans/bycategory')
}

export const plansCategory = () => {
    return request.get('/plans/category')
}

export const plansCategoryAdd = (categoryname) => {
    return request.post('/plans/category',null,{
        params: {
            categoryname
        }
    })
}

export const plansCategoryDelete = (id) => {
    return request.delete('/plans/category/' + id)
}

export const getMonthView = (year,month) => {
    return request.get('/plans/month',{
        params: {
            month,
            year
        }
    })
}

export const planAi = (message) => {
    return request.post('/plans/ai/analyse',{
        message
    })
}